package com.zyh.scs.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyh.scs.admin.api.entity.UserCompany;
import com.zyh.scs.admin.mapper.UserCompanyMapper;
import com.zyh.scs.admin.service.UserCompanyService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author hwh
 * @ClassName: 公司api接口实现类$
 * @Description: $
 * @Date $
 * @Version 1.0
 */
@Slf4j
@Service
@AllArgsConstructor
public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserCompany> implements UserCompanyService {


    private final UserCompanyMapper userCompanyMapper;

    @Override
    public IPage getCompanyPage(Page page) {
        Page<UserCompany> userCompanyPage = new Page<>(page.getCurrent(), page.getSize());
        return userCompanyMapper.selectPage(page, Wrappers.<UserCompany>lambdaQuery().eq(UserCompany::getDelFlag, "0"));
    }

    @Override
    public UserCompany getCompanyById(Long companyId) {
        return userCompanyMapper.selectById(companyId);
    }


}
